<script setup>
import { ref, onMounted } from 'vue'
import { useUserStore } from '@/stores'
import { useGetRecentSevenDaysTasksService } from '@/api/task'

const userStore = useUserStore()
const { userId } = userStore

// 最近七日任务列表
const recentSevenDaysTasksList = ref([])

// 获取今日任务列表
const getRecentSevenDaysTasks = async () => {
  const res = await useGetRecentSevenDaysTasksService({ user_id: userId })
  recentSevenDaysTasksList.value = res.data.data
  console.log('最近七日任务列表:' + JSON.stringify(recentSevenDaysTasksList.value))
}
// 页面加载时获取最近七日任务列表
onMounted(() => {
  getRecentSevenDaysTasks()
})
</script>

<template>
  <AddTasksContent @refreshTasks="getRecentSevenDaysTasks" :taskList="recentSevenDaysTasksList" classifyName="最近七天"></AddTasksContent>
</template>

<style lang="less" scoped>
</style>
